import React, { Component } from 'react'
import Child from './Child'
import Child2 from './Child2'

export default class App extends Component {
  state = {
    info: '',
  }

  // 1. 父组件定义一个操作数据的方法
  updateInfo = (info) => {
    this.setState({
      info,
    })
  }
  render() {
    return (
      <div>
        <h3>父组件</h3>
        <hr />
        <Child info={this.state.info}></Child>
        <Child2 updateInfo={this.updateInfo}></Child2>
      </div>
    )
  }
}
